package yamaia.musicPlayerTester;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;

public class testDialLogActivity extends Activity {
	testDialLogActivity m_Context;
	Handler m_Handler = new Handler();
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    // TODO Auto-generated method stub
	    m_Context = this;
	    Intent intent = getIntent();
	    Log.d("reavelv", "action = " + intent.getAction());
	    Log.d("reavelv", "Scheme" + intent.getScheme());
	    Log.d("reavelv", "type = " + intent.getType());
	    Log.d("reavelv", "data = " + intent.getData());
//	    Log.d("reavelv", "Intent.EXTRA_TEXT = " + intent.getExtras().get(Intent.EXTRA_TEXT));
//	    String str = (String) intent.getExtras().get(Intent.EXTRA_TEXT);
//	    Log.d("reavelv", "str = " + str);
//	    String[] strs = str.split("\n");
//	    for(String sss : strs){
//		    Log.d("reavelv", "sss = " + sss);
//	    }
//	    str = str.replace("\n", " ");
//	    setTitle(str);
	    
//	    Intent intent = new Intent (Intent.ACTION_DIAL,Uri.parse("tel:"+tmpTel));
//	    Intent intent1 = new Intent (Intent.ACTION_CALL,Uri.parse("tel:"+"01063385308"));
//	    startActivity(intent1);
	    
//	    popupAMConfig(str);
        //popupAMConfig();
//	    int brightness = getIntent().getIntExtra("brightness", 255);
//	    
//	    Window window = getWindow();
//		Date stime = new Date(System.currentTimeMillis());
//		Date etime = new Date(System.currentTimeMillis());
//		if(brightness == 0)
//			window.getAttributes().screenBrightness = 0.05f;
//		else{
//			Log.d("reavelv", "brightness = " + (float)((float)brightness / 255));
//			window.getAttributes().screenBrightness = (float)((float)brightness / 255);
//		}
//		Log.d("reavelv", "stime = " + stime.getTime());
//		Log.d("reavelv", "etime = " + etime.getTime());
//		
//		while(etime.getTime() - stime.getTime() < 1){
//			etime = new Date(System.currentTimeMillis());
//			Log.d("reavelv", "stime = " + stime.getTime());
//			Log.d("reavelv", "etime = " + etime.getTime());
//		}
//		
//		new Thread(new Runnable() {
//			
//			@Override
//			public void run() {
//				// TODO Auto-generated method stub
//				m_Handler.postAtTime(new Runnable() {
//					
//					@Override
//					public void run() {
//						// TODO Auto-generated method stub
//						m_Context.finish();
//					}
//				}, 1000);
//			}
//		}).start();
		
	}

	private void popupAMConfig(String str) {
		AlertDialog.Builder dialogB = new Builder(m_Context);
		dialogB.setMessage(str).setNegativeButton("Manual", new OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
//				Log.d(TAG, "No BT");
//				m_Context.delNotify(m_Context);
//				m_Context.startService(new Intent("lgu.ubivelox.client.stopsync"));
//				m_Context.finish();
			}
		}).setPositiveButton("Auto", new OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				
			}

		}).setCancelable(false).create().show();
	}

}
